#作业1-1
#九九乘法表：使用for循环
for i in range(1,10):#正向
    for j in range(1,i+1):
        print("{}*{}={:<4d}".format(j,i,i*j),end="")
    print()
print("====================================================================================")
for j in range(9,0,-1):#反向
    for i in range(1,j+1):
        print("{}*{}={:<4d}".format(i,j,i*j),end="")
    print()
print("====================================================================================")
for i in range(1,10):
    print(" "*(9-i)*8,end="")
    for j in range(i,0,-1):
        print("{}*{}={:<4d}".format(j,i,j*i),end="")
    print()
print("====================================================================================")
for i in range(9,0,-1):
    print(" "*(9-i)*8,end="")
    for j in range(i,0,-1):
        print("{}*{}={:<4d}".format(j,i,j*i),end="")
    print()
print("====================================================================================")


##九九乘法表：使用while循环
j = 1
while j <= 9:
    i = 1
    while i <= j:
        print("{}*{}={:<4d}".format(i,j,i*j),end="")
        i = i + 1
    print()
    j = j + 1
print("====================================================================================")
j = 9
while j >= 1:
    i = 1
    while i <= j:
        print("{}*{}={:<4d}".format(i,j,i*j),end="")
        i = i + 1
    print()
    j = j - 1
print("====================================================================================")
j = 1
while j <= 9:
    i = j
    print(" " * (9 - i) * 8, end="")
    while i >= 1:
        print("{}*{}={:<4d}".format(i, j, i * j), end="")
        i = i - 1
    print()
    j = j + 1
print("====================================================================================")
j = 9
while j >= 1:
    i = j
    print(" " * (9 - i) * 8, end="")
    while i >= 1:
        print("{}*{}={:<4d}".format(i, j, i * j), end="")
        i = i - 1
    print()
    j = j - 1
print("====================================================================================")

